﻿/**
 * ...
 * @author waneck
 */

package asc.events;

enum NetStreamStatus 
{

	NetStreamPublishStart;
	NetStreamPublishBadName;
	NetStreamUnpublishSuccess;
	NetStreamRecordStart;
	NetStreamRecordStop;
	NetStreamRecordNoAccess;
	NetStreamRecordFailed;
	NetStreamRecordDiskQuotaExceeded;
	
}

enum NetStreamAdvanced //Those are not documented to be passed by netStream.onStatus()
{
	
	NetStream.Clear.Failed
	NetStream.Clear.Success
	NetStream.Failed
	NetStream.Play.Failed
	NetStream.Play.InsufficientBW
	NetStream.Play.Start
	NetStream.Play.StreamNotFound
	NetStream.Play.Stop
	NetStream.Play.Reset
	NetStream.Play.PublishNotify
	NetStream.Play.UnpublishNotify
	NetStream.Publish.BadName
	NetStream.Publish.Start
	NetStream.Record.Failed
	NetStream.Record.NoAccess
	NetStream.Record.Start
	NetStream.Record.Stop
	NetStream.Unpublish.Success
	
}

class NetStreamStatusTranslator
{
	public static function translate(infoObject: { code:String, level:String } ):NetStreamStatus
	{
		return switch (infoObject.code)
		{
			case "NetStream.Publish.Start":
				NetStreamPublishStart;
			case "NetStream.Publish.BadName":
				NetStreamPublishBadName
			case "NetStream.Unpublish.Success":
				NetStreamUnpublishSuccess
			case "NetStream.Record.Start":
				NetStreamRecordStart
			case "NetStream.Record.Stop":
				NetStreamRecordStop
			case "NetStream.Record.NoAccess":
				NetStreamRecordNoAccess
			case "NetStream.Record.Failed":
				NetStreamRecordFailed
			case "NetStream.Record.DiskQuotaExceeded":
				NetStreamRecordDiskQuotaExceeded
		}
	}

}